using UnityEngine;
using System.Collections;

public class Moedas : MonoBehaviour {
	
	float speed;
	
	public float Value;
	public Vector2 size;
	public Texture texture;
	
	void Start () {
		
		gameObject.AddComponent("MeshRenderer");
		gameObject.AddComponent("MeshFilter");
	
		Mesh mesh = Quad.Create(size.x,size.y);
		gameObject.GetComponent<MeshFilter>().mesh = mesh;
		gameObject.GetComponent<MeshRenderer>().material = (Material) Resources.Load("Outros/Transparent");
		gameObject.GetComponent<MeshRenderer>().material.mainTexture = texture;
	
	}
	
	void Update()
	{
		speed = Value * Time.deltaTime;
		transform.Translate(-speed , 0 , 0);
	}
		
	void OnCollisionEnter (Collision c)
	{
		if(c.gameObject.CompareTag("Player"))
		{
			_Player.f_coins += 1;
			Destroy(gameObject);
		}
	}
}
